import 'package:flutter/material.dart';

class StepDemo extends StatefulWidget {
  const StepDemo({super.key});

  @override
  State<StepDemo> createState() => _StepDemoState();
}

class _StepDemoState extends State<StepDemo> {
  int _currentStep = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('StepDemo'),
        elevation: 0.0,
      ),
      body: Container(
        padding: EdgeInsets.all(16.0),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Stepper(
              currentStep: _currentStep,
              onStepTapped: (int value){
                setState(() {
                  _currentStep = value;
                });
              },
              onStepContinue: (){
                setState(() {
                  _currentStep < 2? _currentStep +=1: _currentStep = 0;
                });
              },
              onStepCancel: (){
                setState(() {
                  _currentStep > 0? _currentStep -=1: _currentStep = 0;
                });
              },
              steps: [
              Step(
                  title: Text('Login'),
                  subtitle: Text('Login first'),
                  content: Text('Manage exeritation duis none sint eu nostrue'),
                  isActive: _currentStep==0),
              Step(
                  title: Text('Chooise Plan'),
                  subtitle: Text('Chooise you plan'),
                  content: Text('Manage exeritation duis none sint eu nostrue'),
                  isActive: _currentStep==1),
              Step(
                  title: Text('Confirm payment'),
                  subtitle: Text('Confirm your payment method'),
                  content: Text('Manage exeritation duis none sint eu nostrue'),
                  isActive: _currentStep==2)
            ])
          ],
        ),
      ),
    );
  }
}
